package gui;

import java.awt.Component;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 * panel for entry of user personal info, name etc.
 * 
 * @author gke703
 */
public class PersonalInfoPanel extends JPanel {

	/** text form for entry of user name */
	protected ValueEntryPanel nameField;

	/** text form for entering user birth date */
	protected ValueEntryPanel birthdateField;

	/** text form for entering user address */
	protected ValueEntryPanel addressField;

	/** text form for entering user phone number */
	protected ValueEntryPanel phonenumberField;

	/** text form for entering user email address */
	protected ValueEntryPanel emailField;

	/**
	 * Initialise the panel which allows new users to fill out info to become
	 * part of the system and to apply for a loan
	 */
	public PersonalInfoPanel() {
		setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));

		// add(Box.createHorizontalGlue());

		// add a label with a prompt to enter the new Student Data
		JLabel prompt = new JLabel("Enter Personal Information");
		prompt.setMaximumSize(prompt.getPreferredSize());
		add(prompt);
		// prompt.setAlignmentY(Component.LEFT_ALIGNMENT);
		prompt.setAlignmentX(Component.LEFT_ALIGNMENT);
		add(Box.createVerticalGlue());

		// add a txtbox with the field for the entry of the student's name
		nameField = new ValueEntryPanel("Name:");
		add(nameField);
		// textField.setMaximumSize(textField.getPreferredSize());
		add(nameField);
		// textField.setAlignmentX(Component.CENTER_ALIGNMENT);
		nameField.setAlignmentX(Component.LEFT_ALIGNMENT);
		add(Box.createVerticalGlue());

		// add a txtbox with the field for the entry of the student's birthdate
		birthdateField = new ValueEntryPanel("birthdate:");
		add(birthdateField);
		birthdateField.setValue("mm/dd/yyyy");
		// birthdateField.setMaximumSize(birthdateField.getPreferredSize());
		add(birthdateField);
		// birthdateField.setAlignmentX(Component.CENTER_ALIGNMENT);
		birthdateField.setAlignmentX(Component.LEFT_ALIGNMENT);
		add(Box.createVerticalGlue());

		// add a txtbox with the field for the entry of the student's address
		addressField = new ValueEntryPanel("address:");
		add(addressField);
		// birthdateField.setMaximumSize(birthdateField.getPreferredSize());
		add(addressField);
		addressField.setAlignmentX(Component.LEFT_ALIGNMENT);
		add(Box.createVerticalGlue());

		// add a txtbox with the field for the entry of the student's phone
		// number
		phonenumberField = new ValueEntryPanel("phone number:");
		add(phonenumberField);
		// birthdateField.setMaximumSize(birthdateField.getPreferredSize());
		add(phonenumberField);
		phonenumberField.setAlignmentX(Component.LEFT_ALIGNMENT);
		add(Box.createVerticalGlue());

		// add a txtbox with the field for the entry of the student's email
		emailField = new ValueEntryPanel("email:");
		add(emailField);
		// birthdateField.setMaximumSize(birthdateField.getPreferredSize());
		add(emailField);
		emailField.setAlignmentX(Component.LEFT_ALIGNMENT);
		add(Box.createVerticalGlue());
	}

	private static final long serialVersionUID = 1L;

}